{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "08210c7d-bb66-46df-bcd2-c03c7001c50a",
   "metadata": {},
   "outputs": [],
   "source": [
    "#例2-7\n",
    "import tensorflow as tf\n",
    "a=tf.Variable(5)   #使用标量创建Variable张量\n",
    "print(\"a=\",a)\n",
    "b=tf.Variable([1,2,3])   #使用向量创建Variable张量\n",
    "print(\"b=\",b)\n",
    "c=tf.Variable([[3.,2.8],[5.3,8]])   #使用矩阵创建Variable张量\n",
    "print(\"c=\",c)\n",
    "#使用生成正态分布随机函数创建Variable张量\n",
    "w=tf.Variable(tf.random.normal([2,2],mean=0,stddev=1))\n",
    "print(\"w=\",w)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.13.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
